package reflect;

import java.lang.reflect.Constructor;

/**
 * 使用反射机制完成如下功能:
 * File file = new File("./test.txt");
 *
 */
public class Test2 {
    public static void main(String[] args) throws Exception {
        Class cls = Class.forName("java.io.File");
        Constructor c = cls.getConstructor(String.class);
        Object obj = c.newInstance("./test.txt");
        System.out.println(obj);
    }
}
